<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="css/bootstrap.css" />
	<link rel="stylesheet" href="wall.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	
	<title>联系人</title>
</head>
<body>
	<div class="navbar">
		<div class="navbar-inner">
			<div class="container">
				<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
				  <span class="icon-bar"></span>
				  <span class="icon-bar"></span>
				  <span class="icon-bar"></span>
				</a>
				<a class="brand" href="#" style="margin-left:50px">${projectname }</a>
				<div class="nav-collapse">
				  <ul class="nav">
					<li><a href="main.jspx">最新动态</a></li>
					<li><a href="goal.jspx">目标</a></li>
					<li><a href="document.jspx">资料库</a></li>
					<li><a href="filetype.jspx">文件共享</a></li>
					<li class="active"><a href="person.jspx">联系人</a></li>
					<li><a href="idea.jspx">想法</a></li>
					<li><a href="#">Bug</a></li>
					<li><a href="#">项目设置</a></li>					
				  </ul>					
				</div>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="span9">
				<ul class="breadcrumb">
					<li class="active">
						<a href="#"><i class="icon-user"></i>联系人</a>
					</li>					
				</ul>
				<div class="row">
					<div class="span3">
						<a href="person.jspx?_m=new" class="btn span2"><i class="icon-plus"></i>添加联系人</a><br/>
						<ul class="unstyled" style="margin-top:20px">
						<c:forEach items="${requestScope.person}" var="p" >
							<li style="line-height:30px">
								<i class="icon-list-alt"></i><a href="javascript:;" class="contact" rel="${p.id }">${p.name }</a>
								
							</li>
							</c:forEach>
						</ul>
						<div class="span6" style="min-height:400px;border-left:1px solid #ccc;margin-left:300px;margin-top:-50px">
						<div id="alert-info" class="alert alert-info">
					      		   请选择联系人
					      </div>
							<address id="address" style="margin-left:20px">
								<!--
								<h3>${requestScope.contact.name }</h3>
								<p>${requestScope.contact.companyname }</p>
								<small>手机</small> ${requestScope.contact.moblie }<br>
								<small>固话</small> ${requestScope.contact.tel }<br><br>
								<small>邮箱</small> ${requestScope.contact.email }<br>
								<small>地址</small>  ${requestScope.contact.address }<br><br>
								<small>主页</small> <a href="http://${requestScope.contact.websit }">${requestScope.contact.websit }</a><br>
								<small>微博</small> <a href="http://${requestScope.contact.weibo}">@${requestScope.contact.weiboname }</a><br>
							-->
							</address>
							<div style="margin-left:20px">
							<div id="notes" class="line"><span style="font-size:16px;font-weight:blod"></span>
							</div>
							<hr/>
							<div id="note" class="span4">
							</div>		<br/><br/><br/>
								
								<br/><br/><br/>
							</div>	
							<div id="action">
								
							</div>						
						</div>
					<div id="action">
								</div>
					</div>
				</div>								
			</div>
		</div>		
	</div>
	<script type="text/javascript">
	
	$(function(){
	
	$("a.contact").click(function(){

	
		var id = this.rel;
				$("#alert-info").hide();
				$("#address").text("");
				$("#notes").text("");
				$("#note").text("");
				$("#action").text("");
		$("#alert-info").hide();
		$("#address").text("");
		$.get("per.jspx?_m=list",{"id":id},function(json){
		 $(json).each(function(){
    					
						$("<h3>").text(this.name).appendTo($("#address"));
						$("<p>").html("公司:"+this.companyname).appendTo($("#address"));
						$("<small>").text("手机: ").appendTo($("#address"));
						$("<span>").text(this.mobile).appendTo($("#address"));
						$("#address").append($("<br>"));
						$("<small>").text("固话 : ").appendTo($("#address"));
						$("<span>").text(this.tel).appendTo($("#address"));
						$("#address").append($("<br>"));
						$("#address").append($("<br>"));
						$("<small>").text("邮箱:  ").appendTo($("#address"));
						$("<span>").text(this.email).appendTo($("#address"));
						$("#address").append($("<br>"));
						$("<small>").text("地址:  ").appendTo($("#address"));
						$("<span>").text(this.address).appendTo($("#address"));
						$("#address").append($("<br>"));
						$("#address").append($("<br>"));
						$("<small>").text("主页  :").appendTo($("#address"));
						$("#address").append($("<a target='_blank' href='http://"+this.web+"'>"+this.web+"</a>"));
						$("#address").append($("<br>"));
						$("<small>").text("微博 : ").appendTo($("#address"));
						$("#address").append($("<a target='_blank' href='http://"+this.introduction+"'>"+"@"+this.introduction+"</a>"));
						$("#address").append($("<br>"));
						$("#notes").append($("<a href=per.jspx?_m=note&id="+this.id+">查看记录</a>").attr("class","btn btn-primary"));
						if(this.notes.length==0){
						//聊天记录为空什么也不显示
						}else {
							var notes = this.notes;
							for(var i=0;i<notes.length;i++) {
								var note = notes[i];
								$("<blockquote>").attr("id",i).appendTo($("#note"));
								$("#"+i).html(note.text);
								if(note.time == undefined){
									//超过一个月时间
									$("<small>").text(note.user.username +"  " + "发布于" + note.createtime).appendTo($("#" + i));
								} else {
									//未超过一个月
									$("<small>").text(note.user.username +"  " + note.time +"发布").appendTo($("#" + i));
								}
							}							
						}
						
						
						
						$("#action").append($("<a href=person.jspx?_m=edit&id="+this.id+">编辑</a>").attr("class","btn btn-primary"));
						$("#action").append($("<a href=person.jspx?_m=del&id="+this.id+">删除</a>").attr("id","delme").attr("class","btn btn-danger"));
					

		});
		
		});
		
		
		
		});

	
		});

	
	</script>
</body>
</html>







